package router

import (
	"gitee.com/baal1990/gitee.com/baal1990/cmd/server/app/business/department"
	"gitee.com/baal1990/gitee.com/baal1990/cmd/server/app/business/frontsetting"
	"gitee.com/baal1990/gitee.com/baal1990/cmd/server/app/business/handler/dictionary"
	faq_ "gitee.com/baal1990/gitee.com/baal1990/cmd/server/app/business/handler/faq"
	kanboard_ "gitee.com/baal1990/gitee.com/baal1990/cmd/server/app/business/handler/kanboard"
	"gitee.com/baal1990/gitee.com/baal1990/cmd/server/app/business/handler/template"
	"gitee.com/baal1990/gitee.com/baal1990/cmd/server/app/business/label"
	"gitee.com/baal1990/gitee.com/baal1990/cmd/server/app/business/message"
	"gitee.com/baal1990/gitee.com/baal1990/cmd/server/app/business/operator"
	"gitee.com/baal1990/gitee.com/baal1990/cmd/server/app/business/process"
	"gitee.com/baal1990/gitee.com/baal1990/cmd/server/app/business/workorder"
	"gitee.com/baal1990/gitee.com/baal1990/cmd/server/app/middleware"
	"github.com/gin-gonic/gin"
)

func Router2Manager(r *gin.Engine) {

	routeManage := r.Group("/manage")
	{
		routeManage.POST("/operator-sms-login", operator.LoginSmsOperator) //操作员短信验证码登录
		routeManage.POST("/operator-login", operator.LoginOperator)        //操作员登录
		routeManage.Use(middleware.TokenCheckOperator())
		{
			//数据字典
			dict := routeManage.Group("/dict")
			dict.Use(middleware.TokenCheckOperator())
			{
				dict.GET("/getdictlist", dictionary.GetDictList)
				dict.PUT("/setdict", dictionary.PutDict)
				dict.PUT("/deldict", dictionary.DelDict)
				dict.PUT("/setdictstatus", dictionary.PutDictStatus)
				dict.GET("/getdictdetail", dictionary.GetDictDetail)
				dict.PUT("/setdictdetail", dictionary.PutDictDetail)
				dict.PUT("/deldictdetail", dictionary.DelDictDetail)
				dict.PUT("/setdictdetailstatus", dictionary.PutDictDetailStatus)
			}
			//模板
			temp := routeManage.Group("/template")
			temp.Use(middleware.TokenCheckOperator())
			{
				temp.GET("/get-template", template.GetTemplate)
				temp.PUT("/put-template", template.PutTemplate)
				temp.PUT("/del-template", template.DelTemplate)
			}
			//常见问题
			faq := routeManage.Group("/faq")
			faq.Use(middleware.TokenCheckOperator())
			{
				faq.GET("/get-faq", faq_.GetFaq)
				faq.PUT("/put-faq", faq_.PutFaq)
				faq.DELETE("/del-faq", faq_.DelFaq)
			}
			//看板
			kanboard := routeManage.Group("/kanboard")
			kanboard.Use(middleware.TokenCheckOperator())
			{
				kanboard.GET("/get-kanboard", kanboard_.GetKanboard)
			}

			//前端设置模块
			routeManage.GET("/registrationprotocol", frontsetting.QueryRegistrationProtocol)   //查询注册协议
			routeManage.POST("/registrationprotocol", frontsetting.UpdateRegistrationProtocol) //更新注册协议内容
			routeManage.GET("/platformnotice", frontsetting.QueryPlatformNotice)               //查询平台须知
			routeManage.POST("/platformnotice", frontsetting.UpdatePlatformNotice)             //更新平台须知
			routeManage.GET("/messagenotice", frontsetting.QueryMessageNotice)                 //查询留言须知
			routeManage.POST("/messagenotice", frontsetting.UpdateMessageNotice)               //更新留言须知
			routeManage.GET("/friendshiplinks", frontsetting.QueryFriendshipLinks)             //查询子公司链接/友情链接 列表
			routeManage.POST("/insert-friendshiplink", frontsetting.InsertFriendshipLink)      //新增子公司链接/友情链接
			routeManage.DELETE("/friendshiplink", frontsetting.DeleteFriendshipLink)           //删除子公司链接/友情链接
			routeManage.POST("/update-friendshiplink", frontsetting.UpdateFriendshipLink)      //更新子公司链接/友情链接
			routeManage.POST("/setfriendshiplinkstatus", frontsetting.SetFriendshipLinkStatus) //更新子公司链接/友情链接的状态

			// 操作员接口
			routeManage.GET("/query-operator", operator.QueryAllOperators)                 //查询所有操作员列表
			routeManage.GET("/query-operator-detail", operator.QueryOperatorDetail)        //查询操作员详情
			routeManage.POST("/insert-operator", operator.AddNewOperator)                  //添加注册新操作员
			routeManage.POST("/update-operator", operator.UpdateOperator)                  //更新操作员信息
			routeManage.POST("/operator-logout", operator.LogoutOperator)                  //操作员登出
			routeManage.DELETE("/delete-operator", operator.DeleteOperator)                //操作员删除
			routeManage.POST("/operator-change-password", operator.OperatorChangePassword) //操作员修改密码
			routeManage.POST("/operator-reset-password", operator.OperatorResetPassword)   //操作员密码重置

			//处理步骤
			routeManage.POST("/process-create-step", process.CreateStep)
			routeManage.DELETE("/process-delete-step", process.DeleteStep)
			routeManage.POST("/update-step", process.UpdateStep)
			routeManage.GET("/query-step", process.QueryAllSteps)
			routeManage.GET("/query-step-detail", process.QueryStepDetail)
			routeManage.GET("/add-step-to-process", process.AddStepToPrecess)

			//流程-
			routeManage.POST("/create-process", process.CreateProcess)
			routeManage.DELETE("/delete-process", process.DeleteProcess)
			routeManage.POST("/update-process", process.UpdateProcess)
			routeManage.GET("/query-process", process.QueryAllProcess)
			routeManage.GET("/query-process-detail", process.QueryProcessDetail)
			routeManage.GET("/search-match-process", process.SearchProcessForWorkOrder) //搜索与工单匹配的流程
			routeManage.GET("/search-step-in-process", process.SearchStepForProcess)    //搜索与流程匹配的步骤

			//部门
			routeManage.POST("/create-department", department.AddNewDepartment)
			routeManage.GET("/query-department", department.QueryAllDepartments)
			routeManage.GET("/query-department-detail", department.QueryDepartmentDetail)
			routeManage.POST("/update-department", department.UpdateDepartment)
			routeManage.DELETE("/delete-department", department.DeleteDepartment)

			//标签
			routeManage.POST("/create-label", label.AddNewLabel)
			routeManage.GET("/query-label", label.QueryAllLabels)
			routeManage.GET("/query-label-detail", label.QueryLabelDetail)
			routeManage.POST("/update-label", label.UpdateLabel)
			routeManage.DELETE("/delete-label", label.DeleteLabel)
			routeManage.POST("/mark-label", label.MarkLabelToWorkOrder)     //打标签
			routeManage.POST("/clear-label", label.ClearLabelFromWorkOrder) //清标签

			//工单+流转
			routeManage.POST("/create-flow", workorder.InsertFlow)                    //添加新流转记录
			routeManage.POST("/finish-flow", workorder.UpdateFlowToEnd)               //流转处理完成
			routeManage.GET("/query-flow-of-order", workorder.QueryFlowOfOrder)       //查询指定工单的流转信息
			routeManage.POST("/workorder-reply", workorder.WorkOrderReply)            //工单答复
			routeManage.GET("/query-option-detail", workorder.QueryWorkerOrderDetail) //查询用户所留言详情
			routeManage.GET("/query-workorder", workorder.QueryOperatorWorkerOrders)  //业务员查询工单列表

			//站内信
			routeManage.POST("/query-message-detail", message.QueryMessageDetail) //查询站内信详情
			routeManage.POST("/query-message", message.QueryOperatorMessages)     //查询站内信列表
		}
	}
}
